﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microformats.Controls;
using System.Web.UI;

namespace Microformats.Controls
{
    public abstract class Coordinate : Entity
    {
        public string Text { get; set; }
        public string Value { get; set; }

        public void Render(ref HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, ClassName);

            if (!string.IsNullOrEmpty(Value))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, Value);
                writer.RenderBeginTag("abbr");
            }
            else
            {
                writer.RenderBeginTag(HtmlTag);
            }

            writer.Write(Text);
            writer.RenderEndTag();
        }
    }
}
